﻿<%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@ Register Src="UCInfo.ascx" TagName="UCInfo" TagPrefix="uc1" %>

<script type="text/javascript">
    var formIndex = 0;
    $(document).ready(function () {
        //add method valid fone
        jQuery.validator.addMethod(
            "validatePhone", function (value) {
                return JS_LIB.isPhone(value);
            }, 'Chỉ được nhập các ký tự : 0123456789.,()-+ ');

        $("#editForm").validate({
            debug: false,
            errorElement: "span",
            errorPlacement: function (error, element) {
                error.tooltip({
                    bodyHandler: function () {
                        return error.html();
                    }
                });
                error.insertAfter(element);
            },
            rules: {
                BusinessName: {
                    required: true
                },
                Address: {
                    required: true,
                    maxlength: 255
                },
                Phone: {
                    validatePhone: true,
                    required: true
                },
                Email: {
                    required: true,
                    email:true
                },
                Representative: {
                    required: true

                },
                Service: {
                    required: true

                }
            },
            submitHandler: function (form) {
                if (formIndex == 0) {
                    form.submit();
                    formIndex++;
                }
            }
        });
    });

</script>
<%using (Html.BeginForm("Edit", "BusinessRegister", FormMethod.Post, new { id = "editForm", @class = "form" }))
  {%>
<uc1:UCInfo ID="UCInfo1" runat="server" />
<% } %>